<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>过滤器</title>
</head>
{% load filters %}
<body>
{% comment %}
{% endcomment %}
<ul>
    {% for book in list %}
        {% if book.id|mod %}
            <li style="color:darkblue;">{{ book.btitle }} -{{ book.id }}-- {{ book.bpub_date }}</li>
        {% else %}
            {% if book.btitle|length > 4 %}
                <li style="color:lightseagreen;">{{ book.btitle }} --- {{ book.bpub_date }}</li>
            {% else %}
                <li style="color:lightcoral;">{{ book.btitle }} --- {{ book.bpub_date|date:'Y-m-j' }}</li>
            {% endif %}
        {% endif %}
    {% endfor %}
</ul>
</body>
</html>